home *** CD-ROM | disk | FTP | other *** search
/ CD ROM Paradise Collection 4 / CD ROM Paradise Collection 4 1995 Nov.iso / ghostscr / ghostscr.zip / XFONTS.DOC < prev   
Text File  |  1993-08-03  |  7KB  |  164 lines

  1.    Copyright (C) 1993 Aladdin Enterprises.  All rights reserved.
  2.  
  3. This file is part of Ghostscript.
  4.  
  5. Ghostscript is distributed in the hope that it will be useful, but
  6. WITHOUT ANY WARRANTY.  No author or distributor accepts responsibility
  7. to anyone for the consequences of using it or for whether it serves any
  8. particular purpose or works at all, unless he says so in writing.  Refer
  9. to the Ghostscript General Public License for full details.
  10.  
  11. Everyone is granted permission to copy, modify and redistribute
  12. Ghostscript, but only under the conditions described in the Ghostscript
  13. General Public License.  A copy of this license is supposed to have been
  14. given to you along with Ghostscript so you can know your rights and
  15. responsibilities.  It should be in a file named COPYING.  Among other
  16. things, the copyright notice and this notice must be preserved on all
  17. copies.
  18.  
  19. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  20.  
  21. This file, xfonts.doc, describes the interface between Ghostscript and the
  22. routines that access externally supplied font and text facilities.
  23.  
  24. For an overview of Ghostscript and a list of the documentation files, see
  25. README.
  26.  
  27. ********
  28. ******** Introduction ********
  29. ********
  30.  
  31. Starting with release 2.6, Ghostscript has the ability to use the
  32. character rasterizer provided by the underlying operating system and
  33. window system; specifically, Adobe Type Manager or a TrueType rasterizer
  34. under MS Windows, and the facilities provided by X Windows.  This ability
  35. augments, but does not replace, Ghostscript's own Type 1 rasterizer:
  36. Ghostscript may still use its own rasterizer for very large characters,
  37. characters that are clipped or transformed in unusual ways, and output to
  38. devices other than the screen.
  39.  
  40. Ghostscript interfaces to these platform facilities through a driver-like
  41. interface called the xfont (external font) interface.  Currently, xfont
  42. implementations are associated directly with device drivers; in a future
  43. release, Ghostscript may separate them, so that (for example) it will be
  44. possible to use the platform rasterizer when writing to a file.
  45.  
  46. Please note that beyond this point, this file is likely to be useful only
  47. to a small number of Ghostscript porters and implementors.
  48.  
  49. ********
  50. ******** Types ********
  51. ********
  52.  
  53. gs_char (defined in gsccode.h)
  54.  
  55.     This type represents a character code that appears in a string.
  56. Currently it is always a single byte, but composite fonts or Unicode may
  57. require it to be wider in the future.
  58.  
  59. gs_glyph (defined in gsccode.h)
  60.  
  61.     This type represents a character name like 'period' or 'epsilon'.
  62. From the xfont implementation's point of view, it is just a handle; when
  63. necessary, Ghostscript provides a gs_proc_glyph_name_t procedure (see next
  64. type) to convert it to a string name.
  65.  
  66. gs_proc_glyph_name_t (defined in gsccode.h)
  67.  
  68.     This type represents a procedure that maps a gs_glyph to its
  69. string name; see the description of char_glyph below.
  70.  
  71. gx_xglyph (defined in gsxfont.h)
  72.  
  73.     This type represents a character or glyph code that can be used
  74. with a specific platform font.  Normally it will be a character code that
  75. the implementation of render_char will turn into a 1-character string and
  76. give to the platform's "display string" operation.
  77.  
  78. gx_xfont_procs (declared in gsxfont.h, defined in gxxfont.h)
  79.  
  80.     This type is the xfont analogue of gx_device_procs, the type of
  81. the procedure record that defines an xfont implementation.
  82.  
  83. gx_xfont (declared in gsxfont.h, defined in gxxfont.h)
  84.  
  85.     This type is the gxfont analogue of gx_device, the type of the
  86. basic structure for an xfont.
  87.  
  88. (encoding_index)
  89.  
  90.     This is not really a type, although it probably should be: it is
  91. an int used to indicate the Encoding used by a font.  Defined values are
  92.     0 = StandardEncoding
  93.     1 = ISOLatin1Encoding
  94.     2 = SymbolEncoding
  95.     3 = DingbatsEncoding
  96.     -1 = other encoding
  97.  
  98. ********
  99. ******** Implementation procedures ********
  100. ********
  101.  
  102. All the procedures that return int results return 0 on success, or an
  103. appropriate negative error code in the case of error conditions.  The
  104. error codes are defined in gserrors.h.  The relevant ones are the same as
  105. for drivers (see drivers.doc for details).
  106.  
  107. As for driverse, if an implementation procedure returns an error, it
  108. should use the return_error macro rather than a simple return statement,
  109. e.g.,
  110.  
  111.     return_error(gs_error_VMerror);
  112.  
  113. This macro is defined in gx.h, which is automatically included by
  114. gdevprn.h but not by gserrors.h.
  115.  
  116. Font-level
  117. ----------
  118.  
  119. gx_xfont *(*lookup_font)(P7(gx_device *dev, const byte *fname, uint len,
  120.   int encoding_index, const gs_uid *puid, const gs_matrix *pmat,
  121.   const gs_memory_procs *mprocs))
  122.  
  123.     Look up a font name, UniqueID, and matrix, and return an xfont, or
  124. NULL if no suitable xfont exists.  Use mprocs to allocate the xfont and
  125. any subsidiary data structures.  The matrix is the FontMatrix concatenated
  126. with the CTM, so (roughly speaking) the font size in pixels is pmat->yy *
  127. 1000 for a normal Type 1 font.
  128.  
  129.     Note that this is the only implementation procedure that does not
  130. take an xfont * as its first argument.  In fact, callers of lookup_font
  131. must use the get_xfont_device driver procedure to get the correct device
  132. to pass as the first argument to lookup_font.
  133.  
  134. gx_xglyph (*char_xglyph)(P5(gx_xfont *xf, gs_char chr, int encoding_index,
  135.   gs_glyph glyph, gs_proc_glyph_name_t glyph_name))
  136.  
  137.     Convert a character name to an xglyph code.  In the case of
  138. glyphshow, chr may be gs_no_char; for an ordinary show operation, if
  139. the character code is invalid, glyph may be gs_no_glyph.
  140.  
  141. int (*char_metrics)(P5(gx_xfont *xf, gx_xglyph xg, int wmode,
  142.   gs_int_point *pwidth, gs_int_rect *pbbox))
  143.  
  144.     Get the metrics for a character.
  145.  
  146. int (*render_char)(P7(gx_xfont *xf, gx_xglyph xg, gx_device *target,
  147.   int x, int y, gx_color_index color, int required))
  148.  
  149.     Render a character.  (x,y) corresponds to the character origin.
  150. The target may be any Ghostscript device.  A good implementation will
  151. check whether the target can handle this type of xfont directly (e.g., by
  152. checking the target name), and if so, will render the character directly;
  153. otherwise, it will do what has to be done in the general case, namely, get
  154. a bitmap for the character and use the target's copy_mono operation.  If
  155. required is false, the procedure should return an error if the rendering
  156. operation would be expensive, since in this case Ghostscript has already
  157. cached the bitmap and metrics from a previous call with required=true.
  158.  
  159. int (*release)(P2(gx_xfont *xf, const gs_memory_procs *mprocs))
  160.  
  161.     Release any external resources associated with an xfont.  If
  162. mprocs is not NULL, also free any storage allocated by lookup_font
  163. (including the xfont itself).
  164.